//
// Created by JYL on 2024-01-13.
//
#include "bsp_key.h"

#define KB1     HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_0)
#define KB2     HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_1)
#define KB3     HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_2)
#define KB4     HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0)
#define KEYPORT (KB1|(KB2<<1)|(KB3<<2)|(KB4<<3)|0xf0)

uint8_t Trg;       //全局变量   ,单次触发
uint8_t Cont;      //全局变量   ,长按
void Key_Read(void)
{
    uint8_t ReadData = (KEYPORT)^0xff;
    Trg = ReadData & (ReadData ^ Cont);
    Cont = ReadData;
}
